import 'package:xin_nuo_pda/bean/bin_info_entity.dart';
import 'package:xin_nuo_pda/bean/edc_data_entity.dart';
import 'package:xin_nuo_pda/bean/lot_entity.dart';
import 'package:xin_nuo_pda/bean/mlot_entity.dart';
import 'package:xin_nuo_pda/bean/ware_house_entity.dart';
import 'package:xin_nuo_pda/http/http_client.dart';
import 'package:xin_nuo_pda/http/http_response.dart';
import 'package:xin_nuo_pda/utils/request_util.dart';
import 'package:dio/dio.dart';
import 'package:get/get.dart';

class LotApi{
  static Future<HttpResponse<LotEntity>> lotInfo(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<LotEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNLOTQUERY',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<MlotEntity>> materialInfo(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
      var response = await Get.find<HttpClient>().post<MlotEntity>(
          'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNMLOTQUERY',parame: params),
        cancelToken: cancelToken
      );
      return response;
  }

  static Future<HttpResponse<EdcDataEntity>> getEdcDate(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<EdcDataEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNGETEDCCURRENT',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<dynamic>> trackIn(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<dynamic>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNLOTTRACKIN',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<dynamic>> trackOut(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<dynamic>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNLOTTRACKOUT',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<dynamic>> bindPart(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<dynamic>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNPARTBINDING',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<dynamic>> testTrackIn(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<dynamic>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.LOTFTTRACKIN',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<BinInfoEntity>> getHB(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<BinInfoEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'EAP.GETHBINREQUEST',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<BinInfoEntity>> simpleTrackOut(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<BinInfoEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'CPC.LOTFTTRACKOUT',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<BinInfoEntity>> report(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<BinInfoEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNSAVEEDCDATA',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<BinInfoEntity>> getSelectorBin(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<BinInfoEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.LOTFTTRACKOUT',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<dynamic>> getLotShip(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<dynamic>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.LOTSHIP',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<WareHouseEntity>> getWarehouseList(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<WareHouseEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.LOTSHIP',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }
}
